# WeaponFactory.gd
extends Node

# 武器场景映射
const WEAPON_SCENES: Dictionary = {
	"shotgun": preload("res://scene/weapon/gun/shot_gun.tscn"),
}

# 根据武器ID创建武器
func create_weapon(weapon_id: String) -> WeaponBase:
	if not WeaponDataManager.get_weapon_data(weapon_id).is_empty():
		if WEAPON_SCENES.has(weapon_id):
			var weapon_scene = WEAPON_SCENES[weapon_id]
			var weapon_instance = weapon_scene.instantiate()
			weapon_instance.weapon_id = weapon_id
			return weapon_instance
	
	printerr("无法创建武器: ", weapon_id)
	return null
